<template>
  <div id="main" />
</template>

<script>
import * as echarts from 'echarts'
export default {
  data() {
    return {

    }
  },

  created() {

  },

  mounted() {
    this.initEcharts()
  },

  methods: {
    initEcharts() {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('main'))
      const option = {
        color: ['pink', 'hotpink'],
        backgroundColor: 'green',
        title: {
          text: 'Basic Radar Chart'
        },
        legend: {
          data: ['小美', '小陆']
        },
        radar: {
          // shape: 'circle',
          // 数据
          indicator: [
            { name: '迟到', max: 100 },
            { name: '满勤', max: 100 },
            { name: '加班', max: 100 },
            { name: '早退', max: 100 },
            { name: '摸鱼', max: 100 }
          ],
          // 指示标 文字颜色
          axisName: {
            color: 'red'
          },
          splitArea: {
            areaStyle: {
              color: ['red', 'green'],
              shadowColor: 'rgba(0, 0, 0, 0.2)',
              shadowBlur: 10
            }
          },
          splitLine: {
            lineStyle: {
              color: [
                'hotpink'
              ]
            }
          }
        },
        series: [
          {
            name: 'Budget vs spending',
            type: 'radar',
            data: [
              {
                value: [50, 90, 100, 90, 0],
                name: '小美'
              },
              {
                value: [50, 0, 90, 0, 90],
                name: '小陆'
              }
            ]
          }
        ]
      }
      // 绘制图表
      myChart.setOption(option)
    }
  }
}
</script>

<style scoped lang='scss'>
#main {
  width: 600px;
  height: 500px;
}
</style>
